package com.goldfish666.remote_control;

import com.goldfish666.remote_control.components.TVInputDisplayer;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.config.BootstrapMode;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication(scanBasePackages = {"com.goldfish666.remote_control"})
@EntityScan("com.goldfish666.remote_control.entity")
@EnableJpaRepositories(basePackages = {"com.goldfish666.remote_control.repository"}, bootstrapMode = BootstrapMode.DEFAULT)
@EnableJpaAuditing
//@EnableAsync
//@EnableCaching
@Slf4j
@EnableSwagger2
@AllArgsConstructor(onConstructor = @__({@Autowired}))
public class RemoteControlApplication implements CommandLineRunner {

    private final TVInputDisplayer inputDisplayer;

    public static void main(String[] args) {
        SpringApplication.run(RemoteControlApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        inputDisplayer.display();
    }
}
